package com.sj.entity;

import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;
import java.time.LocalDateTime;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

/**
 * <p>
 * 足迹表
 * </p>
 *
 * @author 孙峻
 * @since 2022-03-09
 */
@Getter
@Setter
@Accessors(chain = true)
@ApiModel(value = "Footprint对象", description = "足迹表")
public class Footprint implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("足迹id 自增长")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty("文章id")
    private Integer articleId;

    @ApiModelProperty("用户id")
    private Integer userId;

    @ApiModelProperty("是否删除 1 删除 0 未删除")
    @TableLogic
    private Boolean del;

    @ApiModelProperty("创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    private LocalDateTime createTime;

    @ApiModelProperty("更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    private LocalDateTime updateTime;

    public static FootprintBuilder builder() {
        return new FootprintBuilder();
    }

    public static final class FootprintBuilder {
        private Integer id;
        private Integer articleId;
        private Integer userId;
        private Boolean del;
        private LocalDateTime createTime;
        private LocalDateTime updateTime;

        private FootprintBuilder() {
        }

        public FootprintBuilder id(Integer id) {
            this.id = id;
            return this;
        }

        public FootprintBuilder articleId(Integer articleId) {
            this.articleId = articleId;
            return this;
        }

        public FootprintBuilder userId(Integer userId) {
            this.userId = userId;
            return this;
        }

        public FootprintBuilder del(Boolean del) {
            this.del = del;
            return this;
        }

        public FootprintBuilder createTime(LocalDateTime createTime) {
            this.createTime = createTime;
            return this;
        }

        public FootprintBuilder updateTime(LocalDateTime updateTime) {
            this.updateTime = updateTime;
            return this;
        }

        public Footprint build() {
            Footprint footprint = new Footprint();
            footprint.setId(id);
            footprint.setArticleId(articleId);
            footprint.setUserId(userId);
            footprint.setDel(del);
            footprint.setCreateTime(createTime);
            footprint.setUpdateTime(updateTime);
            return footprint;
        }
    }
}
